package com.boilermaker.lotterysystem.service.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum UserIdentityEnum {

    ADMIN("管理员"),
    NORMAL("普通用户");

    private final String identityName;

    /**
     * 根据名字获取枚举值
     *
     * @param name: ADMIN / NORMAL
     * @return: enum
     */
    public static UserIdentityEnum forName(String name) {

        for (UserIdentityEnum e : UserIdentityEnum.values()) {
            if (e.name().equalsIgnoreCase(name)) {
                return e;
            }
        }
        return null;
    }
}
